package com.icss.impl;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;

import com.icss.base.logging.Log;
import com.icss.base.logging.LogFactory;

public class Execute extends Thread{
	
	private static Log log  = LogFactory.getLog(Execute.class);
	
	InputStream is;  
	    String type;  
	  
	    public Execute(InputStream is, String type) {  
	        this.is = is;  
	        this.type = type;  
	    }  
	  
	    public void run() {  
	        try {  
	        	log.info("is:"+is);
	        	log.info("type:"+type);
	            InputStreamReader isr = new InputStreamReader(is);  
	            BufferedReader br = new BufferedReader(isr);  
	            String line = null;  
	            while ((line = br.readLine()) != null) {  
	                if (type.equals("Error")) {  
	                    System.out.println("Error   :" + line);  
	                } else {  
	                    System.out.println("Debug:" + line);  
	                }  
	            }  
	        } catch (IOException ioe) {  
	        	log.info("Execute出错");
	        	log.info(ioe);
	            ioe.printStackTrace();  
	        }  
	    }  
}
